package com.baizhi.wwk.controller;

import com.baizhi.wwk.dto.Dto;
import com.baizhi.wwk.entity.User;
import com.baizhi.wwk.service.UserService;
import com.baizhi.wwk.service.UserServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
@CrossOrigin
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserServiceImpl userService;

    @RequestMapping("queryAllPage")
    @ResponseBody
    public Map<String,Object> queryAllPage(@RequestBody Dto dto){
        return userService.queryAllPage(dto.getPage(),dto.getPageSize());
    }
    @ResponseBody
    @RequestMapping("update")
    public Map<String,Object> update(@RequestBody User user){
        return userService.update(user.getId(),user.getStatus());
    }
}
